package com.wyd.principle.InterfaceSegregation;

public class InterfaceSegregationDemo01 {

}

interface IOperation{
    void operation1();
    void operation2();
    void operation3();
    void operation4();
    void operation5();
}

class OperationImplA implements IOperation{
    public void operation1() {
        System.out.println("OperationImplA 实现了 operation1");
    }

    public void operation2() {
        System.out.println("OperationImplA 实现了 operation2");
    }

    public void operation3() {
        System.out.println("OperationImplA 实现了 operation3");
    }

    public void operation4() {
        System.out.println("OperationImplA 实现了 operation4");
    }

    public void operation5() {
        System.out.println("OperationImplA 实现了 operation5");
    }
}

class OperationImplB implements IOperation{
    public void operation1() {
        System.out.println("OperationImplB 实现了 operation1");
    }

    public void operation2() {
        System.out.println("OperationImplB 实现了 operation2");
    }

    public void operation3() {
        System.out.println("OperationImplB 实现了 operation3");
    }

    public void operation4() {
        System.out.println("OperationImplB 实现了 operation4");
    }

    public void operation5() {
        System.out.println("OperationImplB 实现了 operation5");
    }
}

/**
 * UserA 只使用了 operation1 2 3 方法
 * 而 IOperation 的实现类必须实现所有方法
 */
class UserA{
    public void operation1(IOperation operation){
        operation.operation1();
        operation.operation2();
        operation.operation3();
    }
}
/**
 * UserB 只使用了 operation1 2 3 方法
 * 而 IOperation 的实现类必须实现所有方法
 */
class UserB{
    public void operation1(IOperation operation){
        operation.operation1();
        operation.operation4();
        operation.operation5();
    }
}